package cn.taobaoke.restful.domain;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import javax.persistence.*;
import java.util.Date;

/**
 * @author yangzuo
 * @since 2017-03-25
 */
@ToString
@Setter
@Getter
@Entity
@Table(name = "tb_order")
@JsonIgnoreProperties(value = {"hibernateLazyInitializer", "handler", "fieldHandler"})
@JsonInclude(JsonInclude.Include.NON_NULL)
public class OrderEntity {

    @Id
    @GeneratedValue
    private Long id;

    @Column
    private Date createTime; // 创建时间

    @Column
    private Date clickTime; // 点击时间

    @Column
    private String commodityInfo; // 商品信息

    @Column
    private String commodityId; // 商品ID

    @Column
    private String aliWangwang; // 掌柜旺旺账号

    @Column
    private String shop; // 所属店铺

    @Column
    private Integer commodityNum; // 商品数

    @Column
    private Double commodityPrice; // 商品单价

    @Column
    private String orderStatus; // 订单状态 : 订单结算, 订单付款, 订单失效, 订单成功

    @Column
    private String orderType; // 订单类型

    @Column
    private Double incomeRatio; // 收入比率

    @Column
    private Double shareRatio; // 分成比率

    @Column
    private Double payment; // 付款金额

    @Column
    private Double effectPrediction; // 效果预估

    @Column
    private Double settlementAmount; // 结算金额

    @Column
    private Double estimatedIncome; // 预估收入

    @Column
    private String settlementTime; // 结算时间

    @Column
    private Double commissionRate; // 佣金比率

    @Column
    private Double commissionAmount; // 佣金金额

    @Column
    private Double subsidyRatio; // 补贴比率

    @Column
    private Double subsidyAmount; // 补贴金额

    @Column
    private String subsidyType; // 补贴类型

    @Column
    private String transactionPlatform; // 成交平台

    @Column
    private String thirdParty; // 第三方服务来源

    @Column
    private String orderNumber; // 订单编号

    @Column
    private String categoryName; // 类目名称

    @Column
    private String mediaId; // 来源媒体ID

    @Column
    private String mediaName; // 来源媒体名称

    @Column
    private String pid;                 // 自己意义上的，PID

    @Column
    private Long grandParentId;         // 祖父代理Id       // Done add by luc 2017/3/27

    @Column
    private Long parentId;              // 父亲代理Id        // Done add by luc 2017/3/27

    @Column
    private Long promoterId;            // 推广者代理Id        // Done add by luc 2017/4/25

    @Column
    private String pidName;             // 广告位名称

    @Column
    private Double adminAmount;         // 管理员结算金额

    @Column
    private Double grandParentAmount;   // 一级代理结算金额(二级抽成)

    @Column
    private Double parentAmount;        // 二级代理结算金额 (一级抽成)

    @Column
    private Double promoterAmount;      // 三级代理分佣结算 (也就是推广者的股份)

    @Column
    private String adPositionId;     // 广告位ID

    @Column
    private Long domainId;

    @Transient
    private AgentEntity agent; // 代理者
}
